﻿using ThirdServices.AlertModel.Factory.BaseInterface;
using ThirdServices.AlertModel.Wanderground;
using ThirdServices.AlertModel.Factory;

namespace ThirdServices.AlertModel.Providers.Wanderground.Factory
{
    public class WandergroundAlerts : AlertBaseFactory
    {
        #region AlertFactory Members

        public IAlert CreateAlert(AlertTypes alert)
        {
            IAlert ialert = null;
            switch (alert)
            {
                case AlertTypes.TempAlert:
                    ialert = new WandergroundTempAlert();
                    break;
                case AlertTypes.WindAlert:
                    ialert = new WandergroundWindAlert();
                    break;
                case AlertTypes.GlobalAlert:
                    ialert = new WandergroundGlobalAlert();
                    break;
            }
            return ialert;
        }

        public IAlert CreateTemperatureAlert(double lat, double lon, double percentage, int periodInDays)
        {
            IAlert iAlert = new WandergroundTempAlert();
            ((WandergroundTempAlert)iAlert).PeriodInDays = periodInDays;
            ((WandergroundTempAlert)iAlert).Lat = lat;
            ((WandergroundTempAlert)iAlert).Lon = lon;
            ((WandergroundTempAlert)iAlert).Percentage = percentage ;
            ((WandergroundTempAlert)iAlert).NumDataPerDay = 1;
            return iAlert;
        }

        public IAlert CreateWindAlert(double lat, double lon, double radius)
        {
            IAlert iAlert = null;
            return iAlert;
        }

        public IAlert CreateGlobalAlert(double lat, double lon, double radius)
        {
            IAlert iAlert = new WandergroundGlobalAlert();
            ((WandergroundGlobalAlert)iAlert).Radius = radius;
            ((WandergroundGlobalAlert)iAlert).Lat = lat;
            ((WandergroundGlobalAlert)iAlert).Lon = lon;
            return iAlert;
        }

        #endregion

        #region AlertBaseFactory Members


        public IAlert CreatePressureAlert(double lat, double lon, double delta, double radius)
        {
            throw new System.NotImplementedException();
        }

        public IAlert CreateFogAlert(double lat, double lon, double delta, double radius)
        {
            throw new System.NotImplementedException();
        }

        public IAlert CreateHumidityAlert(double lat, double lon, double delta, double radius)
        {
            throw new System.NotImplementedException();
        }

        public IAlert CreateEarthquakeAlert(int pointsMax, double latMax, double latMin, double lonMax, double lonMin)
        {
            throw new System.NotImplementedException();
        }

        #endregion
    }
}